package com.three.storemanage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.three.core.entity.StoreLabels;
import com.three.core.vo.R;
import com.three.storemanage.service.StoreLabelsService;
import com.three.storemanage.vo.LabelsVo;
import com.three.storemanage.vo.SearchForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @FileName: LabelsController
 * @Description:
 * @Author: GYX
 * @CreateTime: 2025/3/12 18:44
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("/store/labels")
public class LabelsController {
    @Autowired
    private StoreLabelsService storeLabelsService;

    @PostMapping("/selectLabels")
    public R<Page<LabelsVo> > selectLabels(@RequestBody SearchForm searchForm) {
        return storeLabelsService.findLabelByCondition(searchForm);
    }

    @PostMapping("/insertLabels")
    public R insertLabels(@RequestBody StoreLabels storeLabels) {
        return storeLabelsService.insertLabel(storeLabels);
    }

    @GetMapping("/deleteLabels")
    public R deleteLabels(Integer labelId) {
        return storeLabelsService.deleteLabel(labelId);
    }

    @PostMapping("/updateLabels")
    public R updateLabels(@RequestBody StoreLabels storeLabels) {
        return storeLabelsService.updateLabel(storeLabels);
    }
}
